<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table id="dataTable">
    <thead>
    <th>图片</th>
    <th>商家</th>
    <th>商品</th>
    <th>价格</th>
    <th>库存</th>
    </thead>
    <tbody>
    <tr th:each="warehouse:${warehouses}">
        <td> <img style="width:700px;height:500px"
                th:src="@{'/photo/'+${warehouse.avatar}}">
        </td>
        <td th:text="${warehouse.marketers.marketersName}"></td>
        <td th:text="${warehouse.goodsName}"></td>
        <td th:text="${warehouse.goodsPrice}"></td>
        <td th:text="${warehouse.sum}"></td>
        <td>
            <a @click="updateWareHouseAgree" th:href="@{'/updateWareHouseAgree/'+${warehouse.warehouseId}}">同意</a>
            <a @click="updateWareHouseDisagree" th:href="@{'/updateWareHouseDisagree/'+${warehouse.warehouseId}}">不同意</a>
        </td>
    </tr>
</table>
<form id="updateForm" method="post">
    <input type="hidden" name="_method" value="PUT">
</form>
<script type="text/javascript" th:src="@{/static/js/vue.js}"></script>
<script type="text/javascript">
    var vue = new Vue({
        el:"#dataTable",
        methods:{
            updateWareHouseAgree:function (event) {
                var updateForm = document.getElementById("updateForm");
                updateForm.action = event.target.href;
                updateForm.submit();
                event.preventDefault();
            },
            updateWareHouseDisagree:function (event) {
                var updateForm = document.getElementById("updateForm");
                updateForm.action = event.target.href;
                updateForm.submit();
                event.preventDefault();
            },
        }
    });
</script>
</body>
</html>